/**
 * @Author Stringzhua
 * @Date 2024/2/2 14:47
 * description:内容复制
 * 将int[] arr1={10,20,30};
 * 拷贝到arr2数组,要求数据空间是独立的
 */
public class ArrayCopy {
    public static void main(String[] args) {
        int[] arr1={10,20,30};
        int[] arr2=new int[arr1.length];
        for (int i = 0; i < arr1.length; i++) {
            arr2[i]=arr1[i];
        }
        System.out.println("arr1 = " + arr1);
        for (int i = 0; i < arr1.length; i++) {
            System.out.println("arr2 = " + arr1[i]);
        }
        System.out.println("arr2 = " + arr2);
        for (int i = 0; i < arr2.length; i++) {
            System.out.println("arr2 = " + arr2[i]);
        }
    }
}
